<?php
namespace app\v1\controller;

use think\Db;

class Index 
{
    
    public function getUserInfo()
    {
  //   	$headers = array(); 
		// foreach ($_SERVER as $key => $value) { 
		//     if ('HTTP_' == substr($key, 0, 5)) { 
		//         $headers[str_replace('_', '-', substr($key, 5))] = $value; 
		//     } 
		// }
     
        $headers = apache_request_headers();


		exit(json_encode(['code'=>40001,'data'=>$headers]));


    	if(!input('key')){
    		exit(json_encode(['code'=>40001,'msg'=>'invalid key']));
    	}

    	if(input('uid')){

    		$data = Db::table('fly_user')->where('uid',input('uid'))->find();

        	exit(json_encode(['code'=>0,'data'=>$data]));

    	}else{
    		$data = Db::table('fly_user')->select();

        	exit(json_encode(['code'=>0,'data'=>$data]));

    	}

        
    }
}